#!/bin/bash
#判断是什么类型的文件
read -t 30 -p "please enter a file name" file
if [ -z "$file" ];then
  echo "empty file cant be found"
  exit 100
elif [ ! -e "$file" ]; then
  echo "file doesnt exists!"
  exit 200
elif [ -d "$file" ]; then
  echo  "this is a dir"
elif [ -f "$file" ]; then
  echo "this is file"
else
  echo "cant found any type"
fi

#判断是否是目录(键盘输入文件名)
read -t 30 -p "please enter a file name" file
if [ -d $file ];then
  echo 'its a dir'
else
  echo 'its not a dir'
fi




